package com.nulgame.bukkit.plugin.messagebuilder;

import com.nulgame.bukkit.plugin.responsebuilder.AntiWordCapResponseBuilder;

import junit.framework.TestCase;

public class AntiWordCapResponseBuilderTestCase extends TestCase {
	public void testToResponse(){
		String responseFormat = "This message contains greater than %AllowedPercentage%% capital words is not allowed";
		String playerName = "chicanh";
		String message ="ABCDEFG";
		AntiWordCapResponseBuilder builder = new AntiWordCapResponseBuilder(responseFormat, playerName, message ,60L);
		assertEquals("This message contains greater than 60% capital words is not allowed", builder.toResponse());
		
		responseFormat = "%PlayerName%, your message is %Message%, this message contains greater than %AllowedPercentage%% capital words is not allowed";
		builder = new AntiWordCapResponseBuilder(responseFormat, playerName, message ,60L);
		assertEquals("chicanh, your message is ABCDEFG, this message contains greater than 60% capital words is not allowed", builder.toResponse());
		
		responseFormat = null;
		builder = new AntiWordCapResponseBuilder(responseFormat, playerName, message ,60L);
		assertNull(builder.toResponse());
	}
}
